package com.java.miaosha.dao;

import com.java.miaosha.entity.GoodsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.java.miaosha.vo.GoodsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 商品表
 * 
 * @author jiangli
 * @email 31346337@qq.com
 * @date 2019-08-31 17:19:06
 */
@Mapper
public interface GoodsDao extends BaseMapper<GoodsEntity> {

	@Select("SELECT g.*,mg.`miaosha_price`,mg.`stock_count`,mg.`start_date`,mg.`end_date` FROM `goods` g LEFT JOIN `miaosha_goods` mg ON g.`id`=mg.`goods_id`")
	List<GoodsVO> goodsVOList();

	@Select("SELECT g.*,mg.`miaosha_price`,mg.`stock_count`,mg.`start_date`,mg.`end_date` FROM `goods` g LEFT JOIN `miaosha_goods` mg ON g.`id`=mg.`goods_id` WHERE g.`id`=#{goodsId}")
	GoodsVO goodsVO(Long goodsId);
	
}
